﻿<div id="demoGrid">
        
</div>

<script language="javascript" type="text/javascript">
    // "/Date(1317417911692)/"

    var grid = new OOGrid("demoGrid");
    grid.Columns = BuildColumns();
    grid.PageSize = 30;
    grid.BodyHeight = 400;
    grid.AjaxOptions = new AjaxOptions("/demo/products", "");
    grid.OnLoadingDataComplete = function (rows) {
        var newRows = new Array();
        for (var i = 0; i < rows.length; i++) {
            var row = rows[i];
            row.CreatedDate = GridHelper.ParseDateFromString(row.CreatedDate);
            newRows.push(row);
        }
        return newRows;
    }
    grid.Initialize();

    function BuildColumns() {
        var columns = new Array();
        var id = new Column();
        id.MemberName = "ID";
        id.Width = 50;
        columns.push(id);

        var name = new Column();
        name.MemberName = "Name";
        name.Width = 150;
        columns.push(name);

        var description = new Column();
        description.MemberName = "Description";
        description.Width = "auto";
        columns.push(description);

        var created = new Column();
        created.MemberName = "CreatedDate";
        created.HeaderHtml = "<b>Created <span style='color:blue'>Date</span></b>";
        created.MemberDataType = DataType.Date;
        created.Width = 250;
        created.CellFormater = function (date) {
            return date + "";
        }
        columns.push(created);

        return columns;
    }
</script>